//
//  BaseViewController.m
//  SnailPost
//
//  Created by 抠泥ser on 16/3/7.
//  Copyright © 2016年 抠泥ser. All rights reserved.
//

#import "BaseViewController.h"
#import "PrefixHeader.pch"

@interface BaseViewController ()

@end

@implementation BaseViewController

//一键换肤
- (void)viewWillAppear:(BOOL)animated
{
    //解档获取数据
    NSString *path =   NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject;
    //2.拼接地址 (按照什么路径 保存为什么文件) (数组和字典写plist)
    NSString *strpath = [path stringByAppendingPathComponent:@"a.plist"];
    
    NSString *str = [NSKeyedUnarchiver unarchiveObjectWithFile:strpath];
    UIColor *bg = [UIColor colorWithPatternImage:[UIImage imageNamed:str]];
    //     判断当前是什么模式
    BOOL model = [ThemeManage shareThemeManage].isNight;
    if (model == YES) {
        
        
        self.view.backgroundColor = [UIColor grayColor];
        
    } else {
        self.view.backgroundColor = [UIColor clearColor];
        [self.view setBackgroundColor:bg];
        //导航栏按钮颜色
        self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:str]];
        //Tabbar按钮颜色
        self.tabBarController.tabBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:str]];
    }
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationController.navigationBar.barTintColor = [UIColor redColor];
//    [self.navigationController.navigationBar setTitleTextAttributes:
//     @{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:20],
//       NSForegroundColorAttributeName:[UIColor goldColor]}];
//    [self.navigationController.navigationBar NightWithType:UIViewColorType2];
    
    
    
//    self.view.backgroundColor = [UIColor whiteColor];
//    self.navigationController.navigationBar.barTintColor = [UIColor redColor];
//    [self.navigationController.navigationBar setTitleTextAttributes:
//     @{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:20],
//       NSForegroundColorAttributeName:[UIColor goldColor]}];
//    self.navigationController.navigationBar.tintColor = [UIColor goldColor];
//    [self.navigationController.navigationBar NightWithType:UIViewColorType2];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
